#include <iostream>
#include <sys/wait.h>
#include <unistd.h>
using namespace std;
int main(){
  int status;
  pid_t pid=fork();//Create child process
  if(pid==0){
    sleep(15);
    return 24;
  }
  else{
    pid_t  cur_pid=0;
    while(!(cur_pid=waitpid(pid,&status,WNOHANG))){
      sleep(3);
      cout<<"sleep 3sec."<<endl;
      cout<<cur_pid<<endl;
    }
    if(WIFEXITED(status)){
      cout<<"Chld send:"<<WEXITSTATUS(status);
    }

  }
  return 0;
    


}
